<template>
<div class="restaurant_wrap">
    <div class="container_title clearfix "><i class="iconfont icon-home left"></i> <span>餐厅之家</span></div>
    <restaurant-list :resdata="resData"></restaurant-list>
</div>
</template>

<script>
var data1 = {
    data: [{
        name: "喜洋洋餐厅1",
        addr: "政立路477",
        sellNum: 10,
        price: 30,
        activity: '买单立享满50元减20元',
        class: "快餐",
        tags: ["环境好", "实惠"]
    }, {
        name: "喜洋洋餐厅2",
        addr: "政立路477",
        sellNum: 20,
        price: 30,
        activity: '买单立享满50元减20元',
        class: "快餐",
        tags: ["环境好"]
    }]
};
var resData = [{
        name: "喜洋洋餐厅1",
        addr: "政立路477",
        sellNum: 10,
        price: 30,
        activity: '买单立享满50元减20元',
        class: "快餐",
        tags: ["环境好", "实惠"]
    }, {
        name: "喜洋洋餐厅2",
        addr: "政立路477",
        sellNum: 20,
        price: 30,
        activity: '买单立享满50元减20元',
        class: "快餐",
        tags: ["环境好"]
    }, {
        name: "喜洋洋餐厅3",
        addr: "政立路477",
        sellNum: 30,
        price: 30,
        activity: '买单立享满50元减20元',
        class: "快餐",
        tags: ["环境好"]
    }, {
        name: "喜洋洋餐厅4",
        addr: "政立路477",
        sellNum: 40,
        price: 30,
        activity: '买单立享满50元减20元',
        class: "快餐",
        tags: ["环境好"]
    }, {
        name: "喜洋洋餐厅5",
        addr: "政立路477",
        sellNum: 50,
        price: 30,
        class: "快餐",
        tags: ["环境好"]
    },

];
export default {
    props: ['data'],
    data() {
        return {
            resData: null,
        }
    },
    components: {},
    created: () => {

    },
    mounted: function () {
        this.$nextTick(() => {
            this.getRestaurants();
        })
    },
    methods: {
        getRestaurants() {
            var that = this;

            // this.$axios.post("/addRestaurants",{
            //     data:resData
            // })
            //     .then(res => {
            //         console.log('添加');

            //         var data = res.data;
            //         console.log(data);

            //     })
            //     .catch(err => {
            //         console.log("发生错误");
            //     });

            this.$post("/restaurants",data1.data)
                .then(res => {
                    console.log('添加');

                    var data = res;
                    console.log(data);

                })
                .catch(err => {
                    console.log("发生错误");
                });

            this.$get("/restaurants")
                .then(res => {
                    if (res.status == 200) {
                        var data = res.data;
                        console.log(data);
                        that.resData = res;
                    }

                })
                .catch(err => {
                    console.log("发生错误");
                });

            // this.$axios.get("/api/wzg/getAccount")
            //     .then(res => {
            //         var data = res.data[0];
            //         console.log(data);

            //     })
            //     .catch(err => {
            //         console.log("发生错误");
            //     });
        }
    }
}
</script>

<style lang="scss" scoped>
.restaurant_wrap {
    padding-top: 0.55rem;

    .container_title {
        color: #f4a41e;
    }
}
</style>
